<%--
  Created by IntelliJ IDEA.
  User: 火禾
  Date: 2020/5/9
  Time: 17:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
<%--    導入jquery,注意点路径问题--%>
    <script src="${pageContext.request.contextPath}/statics/js/jquery.min.js"></script>
<%--    //将文本框的值--%>
<%--    // 发送给服务器，--%>
<%--    // 并获得服务器返回值--%>
    <script type="text/javascript">
        function a1(){
            $.ajax({
                url:"${pageContext.request.contextPath}/ajax/a1",
                data:{'name':$("txtName").val()},
                success:function (data,status) {
                    alert(data);
                    alert(status);
                }
            });
        }
        function a2() {
            $.ajax({
                url:"${pageContext.request.contextPath}/ajax/a2",
                data:{'pwd':$("#tpwd").val()},
                success:function (data,status) {
                    // alert(data);
                    alert()
                    alert(status);
                }
            });
        }
    </script>
</head>
<body>
<%--失去焦点--%>
用户名：<input type="text"  id="txtName" onblur="a1()"/>
<p>
    密码:<input type="text" id="tpwd">
    <input type="button" onclick="a2()" value="提交!">
</p>
</body>
</html>
